export function setItem(userInfo) {
  localStorage.setItem('authCodes', JSON.stringify(userInfo.authCodes))
  localStorage.setItem('depts', JSON.stringify(userInfo.depts))
  localStorage.setItem('isAdmin', userInfo.isAdmin)
  localStorage.setItem('menuList', JSON.stringify(userInfo.menuList))
  localStorage.setItem('roleIds', JSON.stringify(userInfo.roleIds))
  localStorage.setItem('roles', JSON.stringify(userInfo.roles))
  localStorage.setItem('sysCompany', JSON.stringify(userInfo.sysCompany))
  localStorage.setItem('sysUser', JSON.stringify(userInfo.sysUser))
}

export function clearItem() {
  localStorage.removeItem('authCodes')
  localStorage.removeItem('depts')
  localStorage.removeItem('isAdmin')
  localStorage.removeItem('menuList')
  localStorage.removeItem('roleIds')
  localStorage.removeItem('roles')
  localStorage.removeItem('sysCompany')
  localStorage.removeItem('sysUser')
  localStorage.removeItem('filterRouter')
}

export function getUserInfo() {
  const user = localStorage.getItem('sysUser')
  return user ? JSON.parse(user) : {}
}
